<template>
	<div>
		<el-dialog :title="$t('action.update')" width="70%" class="icon-dialog" :visible.sync="show" @open="open" :before-close="closeForm" append-to-body>
			<el-form :size="size" ref="form" :model="form" :rules="rules" :label-width="$store.getters.device !== 'mobile'?'16%':'90px'">
 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_entryId')" prop="entryId">
							<el-input v-model="form.entryId" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_entryId')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_fid')" prop="fid">
							<el-input v-model="form.fid" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_fid')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_materialNo')" prop="materialNo">
							<el-input v-model="form.materialNo" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_materialNo')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_materialName')" prop="materialName">
							<el-input v-model="form.materialName" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_materialName')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_specification')" prop="specification">
							<el-input v-model="form.specification" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_specification')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_unitId')" prop="unitId">
							<el-input v-model="form.unitId" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_unitId')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_unit')" prop="unit">
							<el-input v-model="form.unit" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_unit')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_planStartDate')" prop="planStartDate">
							<el-input v-model="form.planStartDate" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_planStartDate')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_planFinishDate')" prop="planFinishDate">
							<el-input v-model="form.planFinishDate" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_planFinishDate')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_count')" prop="count">
							<el-input v-model="form.count" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_count')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_batchNo')" prop="batchNo">
							<el-input v-model="form.batchNo" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_batchNo')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_batch')" prop="batch">
							<el-input v-model="form.batch" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_batch')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_specifyDate')" prop="specifyDate">
							<el-input v-model="form.specifyDate" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_specifyDate')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_createUserName')" prop="createUserName">
							<el-input v-model="form.createUserName" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_createUserName')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_createUserId')" prop="createUserId">
							<el-input v-model="form.createUserId" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_createUserId')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_createTime')" prop="createTime">
							<el-input v-model="form.createTime" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_createTime')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_updateTime')" prop="updateTime">
							<el-input v-model="form.updateTime" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_updateTime')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
	 				 <el-row >
					<el-col :span="24">
						<el-form-item :label="$t('field.Proorderlist_updateUserName')" prop="updateUserName">
							<el-input v-model="form.updateUserName" autoComplete="off" clearable  :placeholder="$t('system.pleaseInput',{title:$t('field.Proorderlist_updateUserName')})">
							</el-input>
						</el-form-item>
					</el-col>
				 </el-row>
				</el-form>
			<div slot="footer" class="dialog-footer">
				<el-button :size="size" :loading="loading" type="primary" @click="submit" >
					<span v-if="!loading">{{$t('system.confirm')}}</span>
					<span v-else>{{$t('system.submitting')}}</span>
				</el-button>
				<el-button :size="size" @click="closeForm">{{$t('system.cancel')}}</el-button>
			</div>
		</el-dialog>
	</div>
</template>
<script>
import { update } from '@/api/app/proorderlist'

export default {
	name:'proorderlistupdate',
	components: {
	},
	props: {
		show: {
			type: Boolean,
			default: false
		},
		size: {
			type: String,
			default: 'small'
		},
		info: {
			type: Object,
		},
	},
	data(){
		return {
		    dialog:{
			},
			form: {
			   entryId:'',
			   fid:'',
			   materialNo:'',
			   materialName:'',
			   specification:'',
			   unitId:'',
			   unit:'',
			   planStartDate:'',
			   planFinishDate:'',
			   count:'',
			   batchNo:'',
			   batch:'',
			   specifyDate:'',
			   createUserName:'',
			   createUserId:'',
			   createTime:'',
			   updateTime:'',
			   updateUserName:'',
			},
		    initial:{},        
			loading:false,
			rules: {
			}
		}
	},
	watch:{
		show(val){
			if(val){
			}
		}
	},
	methods: {
		open(){
			this.form = this.info
		},
		submit(){
			this.$refs['form'].validate(valid => {
				if(valid) {
					this.loading = true
					update(this.form).then(res => {
						if(res.status == 200){
							this.$message({message: this.$t('system.success'), type: 'success'})
							this.$emit('refresh_list')
							this.closeForm()
						}
					}).catch(()=>{
						this.loading = false
					})
				}
			})
		},
		closeForm(){
			this.$emit('update:show', false)
			this.loading = false
			if (this.$refs['form']!==undefined) {
				this.$refs['form'].resetFields()
			}
		},
	}
}
</script>
<style scoped lang="scss">
@import '@/assets/scss/common.scss'
</style>
